<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
<head>
    <title>列表页示例</title>

    <th:block th:include="fragment_header :: header">
    </th:block>
</head>
<body>
<div th:replace="fragment_menu :: navmenu"></div>
<h5 class="text-center">考试信息管理</h5>

<div>
    <div style="margin-left: 10px;margin-top: 10px">
        <a th:href="@{ ${ #mvc.url('EC#add').build() } }" class="btn btn-primary">添加考试</a>
        <a href="/exam_student/students" class="btn btn-primary" tabindex="-1" role="button">考生管理</a>

    </div>
    <div class="alert alert-success alert-dismissible fade show" th:if="${ success eq 'success' }">
        <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
        <strong th:text="${success}">操作成功</strong>
    </div>


    <div style="padding: 50px 100px 10px" class="pre-scrollable">
<!--        <table class="table table-striped table-hover text-center">-->
        <table class="table table-bordered" style="background-color:#FFFFFF;">

        <thead class="table-secondary">
            <tr>
                <th>考试名称</th>
                <th>考试日期</th>
                <th>考试时长</th>
                <th>考试总分</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="exam: ${examList1}">
                <td th:text="${exam.name}"></td>
                <td th:text="${exam.examAt}"></td>
                <td th:text="${exam.timeLimit}"></td>
                <td th:text="${exam.totalScore}"></td>

                <td>
                    <!--                    <button id="editTable" type="button" style="margin:5px" class="btn  btn-xs btn-info">Edit</button>-->
                    <a th:href="@{/exam/del/{id}(id=${exam.id})}" class="btn btn-danger btn-sm" tabindex="-1"
                       role="button">删除信息</a>&nbsp;
                    <a th:href="@{/exam/find/{id}(id=${exam.id})}" class="btn btn-primary btn-sm" tabindex="-1"
                       role="button">修改信息</a>
                    <!--                    <button id="deleteTable" type="button" style="margin:5px" class="btn  btn-xs btn-danger">Del</button>-->

                </td>
            </tr>
            </tbody>
        </table>
    </div>


</div>
<script type="text/javascript">
    var tale = new $.tale();
    function delPost(cid) {
        tale.alertConfirm({
            title:'确定删除该文章吗?',
            then: function () {
                tale.post({
                    url : '/admin/article/delete',
                    data: {cid: cid},
                    success: function (result) {
                        if(result && result.code == 'success'){
                            tale.alertOkAndReload('文章删除成功');
                        } else {
                            tale.alertError(result.msg || '文章删除失败');
                        }
                    }
                });
            }
        });
    }

</script>
</body>
</html>
